#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int d[N], n;
map<int, int> s[N];
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a, b; cin >> a >> b;
        if(a+b+1>n) continue;
        int l = a+1, r = n-b;
        s[r][l]++;
    }
    int maxx = 0;
    for (int r = 1; r <= n ; ++r) {
        d[r] = maxx;
        for(auto m:s[r]){
            int l = m.first, cnt = m.second;
            cnt = min(r-l+1, cnt);
            d[r] = max(d[r], d[l-1] + cnt);
        }
        maxx = max(maxx, d[r]);
    }
    cout << n-d[n];
    return 0;
}